var jsonData = {
		"attrList": [{
				"attrName": "填充物重量",
				"attrValue": "2000g/2300g"
			},
			{
				"attrName": "尺寸",
				"attrValue": "200*230cm/220*240cm"
			},
			{
				"attrName": "面料",
				"attrValue": "100%棉"
			},
			{
				"attrName": "填充物",
				"attrValue": "100%羊毛"
			},
			{
				"attrName": "温馨提示",
				"attrValue": "1.经过碳化、清洗、梳理的天然羊毛被带会有少量味道，通风晾晒2-3天即可散去 2.为减少羊毛漂白等化学用品的处理时间，部分羊毛可能未完全脱色，轻微泛黄属羊毛原色，为正常现象。"
			}
		],
		"colorNum": 0,
		"comments": [{
			"commentReplyVO": null,
			"content": "喜欢",
			"createTime": 1455872259076,
			"frontUserAvatar": "",
			"frontUserName": "m****5",
			"id": 1114554,
			"itemIconUrl": "http://yanxuan.nosdn.127.net/e315749c09b294f6399eed460ff2adb4.jpg",
			"itemId": 1006007,
			"itemName": "秋冬保暖加厚澳洲羊毛被",
			"packageId": 1150460,
			"picList": [],
			"skuId": 1006022,
			"skuInfo": ["规格:2公斤"]
		}],
		"extraPrice": "",
		"flashPageLink": "",
		"gradientPrice": null,
		"hdrkDetailVOList": [{
			"activityType": "旧爱换季",
			"endTime": 1488470399000,
			"huodongUrlWap": "http://m.you.163.com/act/pub/cAenWaVaxa.html",
			"id": 1058000,
			"name": "每满100减25，立领75折券",
			"startTime": 1487952000000
		}],
		"id": 1006007,
		"issueList": [{
				"answer": "单笔订单金额（不含运费）满88元免邮费；不满88元，每单收取10元运费。",
				"question": "购买运费如何收取？"
			},
			{
				"answer": "严选默认使用顺丰快递发货（个别商品使用其他快递），配送范围覆盖全国大部分地区（港澳台地区除外）。",
				"question": "使用什么快递发货？"
			},
			{
				"answer": "1.自收到商品之日起30日内，顾客可申请无忧退货，退款将原路返还，不同的银行处理时间不同，预计1-5个工作日到账；\n2.内裤和食品等特殊商品无质量问题不支持退货\n3.退货流程：\n确认收货-申请退货-客服审核通过-用户寄回商品-仓库签收验货-退款审核-退款完成；\n4.因网易严选产生的退货，如质量问题，退货邮费由网易严选承担，退款完成后会以现金券的形式报销。因客户个人原因产生的退货，购买和寄回运费由客户个人承担。",
				"question": "如何申请退货？"
			},
			{
				"answer": "1.如需开具普通发票，请在下单时选择“我要开发票”并填写相关信息（APP仅限2.4.0及以上版本）；\n2.如需开具增值税专用发票，请在购买后联系客服办理；\n3.可选开票内容：\n订单中含有办公用品（箱包、文具、口罩）--办公用品等、耗材等、日用品、家居用品、食品、酒/饮料、服饰、化妆品；\n不含有办公用品--日用品、家居用品、食品、酒/饮料、服饰、化妆品；\n订单商品为礼品卡--预付卡。",
				"question": "如何开具发票？"
			}
		],
		"itemDetail": {
			"detailHtml": "<p><img src=\"http://yanxuan.nosdn.127.net/c78ec6e16d8477525c0a59e3c9d847b8.jpg\" _src=\"http://yanxuan.nosdn.127.net/c78ec6e16d8477525c0a59e3c9d847b8.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/294185760b75f364f6ed42784877e59c.jpg\" _src=\"http://yanxuan.nosdn.127.net/294185760b75f364f6ed42784877e59c.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/2468d1851e29930cc3802f125da5d6e8.jpg\" _src=\"http://yanxuan.nosdn.127.net/2468d1851e29930cc3802f125da5d6e8.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/0794791277945c1577776724778124f8.jpg\" _src=\"http://yanxuan.nosdn.127.net/0794791277945c1577776724778124f8.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/6973ca1e6f264620d5d25e581a0d623d.jpg\" _src=\"http://yanxuan.nosdn.127.net/6973ca1e6f264620d5d25e581a0d623d.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/26f01273c833c2ae75177a5c8d9310ef.jpg\" _src=\"http://yanxuan.nosdn.127.net/26f01273c833c2ae75177a5c8d9310ef.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/bf0207da5160588acf58d0f02ea9d360.jpg\" _src=\"http://yanxuan.nosdn.127.net/bf0207da5160588acf58d0f02ea9d360.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/dbd5d5171a309344d05663952930441f.jpg\" _src=\"http://yanxuan.nosdn.127.net/dbd5d5171a309344d05663952930441f.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/e7a65ac0824fc1584c2f1943ed1eaed0.jpg\" _src=\"http://yanxuan.nosdn.127.net/e7a65ac0824fc1584c2f1943ed1eaed0.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/88871ed9eccf7fbdfccf7912bb8f9d21.jpg\" _src=\"http://yanxuan.nosdn.127.net/88871ed9eccf7fbdfccf7912bb8f9d21.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/7aa0e4c0abeb157e231b17e91cfa8f02.jpg\" _src=\"http://yanxuan.nosdn.127.net/7aa0e4c0abeb157e231b17e91cfa8f02.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/a38f897200e305e7b23d62431b9c4d18.jpg\" _src=\"http://yanxuan.nosdn.127.net/a38f897200e305e7b23d62431b9c4d18.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/bb147c0e96cdac2d77ab4eef1785e99d.jpg\" _src=\"http://yanxuan.nosdn.127.net/bb147c0e96cdac2d77ab4eef1785e99d.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/c6a270f7aed68cfe74e66d720c776fca.jpg\" _src=\"http://yanxuan.nosdn.127.net/c6a270f7aed68cfe74e66d720c776fca.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/c2c0b548be17f620db8afbe039a99452.jpg\" _src=\"http://yanxuan.nosdn.127.net/c2c0b548be17f620db8afbe039a99452.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/155fe0023e17bac4af486a6c1c098537.jpg\" _src=\"http://yanxuan.nosdn.127.net/155fe0023e17bac4af486a6c1c098537.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/8f1f120ca7e362595fd986ea6de8814f.jpg\" _src=\"http://yanxuan.nosdn.127.net/8f1f120ca7e362595fd986ea6de8814f.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/6971f0333e0eeef7d9951edad068d4ec.jpg\" _src=\"http://yanxuan.nosdn.127.net/6971f0333e0eeef7d9951edad068d4ec.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/c307630edf971e408938f1007169fa53.jpg\" _src=\"http://yanxuan.nosdn.127.net/c307630edf971e408938f1007169fa53.jpg\" style=\"\"/><\/p><p><img src=\"http://yanxuan.nosdn.127.net/4ea2ba74fb518a298ef825c43ed634f4.jpg\" _src=\"http://yanxuan.nosdn.127.net/4ea2ba74fb518a298ef825c43ed634f4.jpg\" style=\"\"/><\/p><p><br/><\/p>",
			"picUrl1": "http://yanxuan.nosdn.127.net/b7e3438c473a296a7e9feecbd4139af5.jpg",
			"picUrl2": "http://yanxuan.nosdn.127.net/70422011e5a9855a0723c9c08d0cbbb0.jpg",
			"picUrl3": "http://yanxuan.nosdn.127.net/f65dbb00aff8b43be02f2c8104208877.jpg",
			"picUrl4": "http://yanxuan.nosdn.127.net/85e8575c8e473a2f71054e9e36b1211c.jpg"
		},
		"limitedFlag": 0,
		"listPicUrl": "",
		"name": "秋冬保暖加厚澳洲羊毛被",
		"newItemFlag": false,
		"pieceNum": 0,
		"pieceUnitDesc": "件",
		"primaryPicUrl": "http://yanxuan.nosdn.127.net/66425d1ed50b3968fed27c822fdd32e0.png",
		"primarySkuId": 1006022,
		"primarySkuPreSellPrice": 0,
		"primarySkuPreSellStatus": 0,
		"productPlace": "",
		"promotionDesc": "限时购",
		"rank": 1,
		"remark": null,
		"reportPicList": [],
		"retailPrice": 459,
		"sellVolume": 3226,
		"seoTitle": "",
		"simpleDesc": "上乘原料，100%澳洲羊毛",
		"skuList": [{
				"counterPrice": 459,
				"giftCardFlag": false,
				"id": 1006022,
				"itemSkuSpecValueList": [{
					"id": 1006022,
					"skuId": 1006022,
					"skuSpec": {
						"id": 1006007,
						"name": "规格",
						"skuSpecValueList": [],
						"type": 0
					},
					"skuSpecId": 1006007,
					"skuSpecValue": {
						"id": 1006022,
						"picUrl": "",
						"skuSpecId": 1006007,
						"value": "200*230cm"
					},
					"skuSpecValueId": 1006022
				}],
				"limitPurchaseCount": 0,
				"limitPurchaseFlag": false,
				"limitedFlag": 0,
				"preSellDesc": "11月20日发货",
				"preSellPrice": 459,
				"preSellStatus": 2,
				"preSellVolume": 3,
				"primarySku": true,
				"purchaseAttribute": 0,
				"retailPrice": 459,
				"sellVolume": 1840,
				"valid": true,
				"virtualFlag": false
			},
			{
				"counterPrice": 499,
				"giftCardFlag": false,
				"id": 1071010,
				"itemSkuSpecValueList": [{
					"id": 1064010,
					"skuId": 1071010,
					"skuSpec": {
						"id": 1006007,
						"name": "规格",
						"skuSpecValueList": [],
						"type": 0
					},
					"skuSpecId": 1006007,
					"skuSpecValue": {
						"id": 1062010,
						"picUrl": "",
						"skuSpecId": 1006007,
						"value": "220*240cm"
					},
					"skuSpecValueId": 1062010
				}],
				"limitPurchaseCount": 0,
				"limitPurchaseFlag": false,
				"limitedFlag": 0,
				"preSellDesc": "",
				"preSellPrice": 0,
				"preSellStatus": 0,
				"preSellVolume": 0,
				"primarySku": false,
				"purchaseAttribute": 0,
				"retailPrice": 499,
				"sellVolume": 1386,
				"valid": true,
				"virtualFlag": false
			}
		],
		"skuMap": {
			"1006022": {
				"counterPrice": 459,
				"giftCardFlag": false,
				"id": 1006022,
				"itemSkuSpecValueList": [{
					"id": 1006022,
					"skuId": 1006022,
					"skuSpec": {
						"id": 1006007,
						"name": "规格",
						"skuSpecValueList": [],
						"type": 0
					},
					"skuSpecId": 1006007,
					"skuSpecValue": {
						"id": 1006022,
						"picUrl": "",
						"skuSpecId": 1006007,
						"value": "200*230cm"
					},
					"skuSpecValueId": 1006022
				}],
				"limitPurchaseCount": 0,
				"limitPurchaseFlag": false,
				"limitedFlag": 0,
				"preSellDesc": "11月20日发货",
				"preSellPrice": 459,
				"preSellStatus": 2,
				"preSellVolume": 3,
				"primarySku": true,
				"purchaseAttribute": 0,
				"retailPrice": 459,
				"sellVolume": 1840,
				"valid": true,
				"virtualFlag": false
			},
			"1062010": {
				"counterPrice": 499,
				"giftCardFlag": false,
				"id": 1071010,
				"itemSkuSpecValueList": [{
					"id": 1064010,
					"skuId": 1071010,
					"skuSpec": {
						"id": 1006007,
						"name": "规格",
						"skuSpecValueList": [],
						"type": 0
					},
					"skuSpecId": 1006007,
					"skuSpecValue": {
						"id": 1062010,
						"picUrl": "",
						"skuSpecId": 1006007,
						"value": "220*240cm"
					},
					"skuSpecValueId": 1062010
				}],
				"limitPurchaseCount": 0,
				"limitPurchaseFlag": false,
				"limitedFlag": 0,
				"preSellDesc": "",
				"preSellPrice": 0,
				"preSellStatus": 0,
				"preSellVolume": 0,
				"primarySku": false,
				"purchaseAttribute": 0,
				"retailPrice": 499,
				"sellVolume": 1386,
				"valid": true,
				"virtualFlag": false
			}
		},
		"skuSpecList": [{
			"id": 1006007,
			"name": "规格",
			"skuSpecValueList": [{
					"id": 1006022,
					"picUrl": "",
					"skuSpecId": 1006007,
					"value": "200*230cm"
				},
				{
					"id": 1062010,
					"picUrl": "",
					"skuSpecId": 1006007,
					"value": "220*240cm"
				}
			],
			"type": 0
		}],
		"soldOut": false,
		"status": 2,
		"tagList": [],
		"underShelf": false,
		"unitPrice": 0
	},
	policyList = [{
			"content": "自收到商品之日起30天内，可在线申请无忧退货服务（内裤、食品等特殊商品除外）。",
			"title": "30天无忧退货"
		},
		{
			"content": "收到退货包裹并确认无误后，将在48小时内办理退款，退款将原路返回，不同银行处理时间不同，预计1-5个工作日到账。",
			"title": "48小时快速退款"
		},
		{
			"content": "单笔订单金额（不含运费）满88元可免邮费，不满88元，单笔订单收取10元邮费。",
			"title": "满88元免邮费"
		},
		{
			"content": "网易原创生活类电商品牌，所有商品均为网易自营，品质保证。",
			"title": "网易自营品牌"
		}
	];
angular.module("myApp").controller("DetailController",["$scope","$http","$timeout",function($scope,$http,$timeout) {
		$scope.json = jsonData;
		$scope.policyList = policyList;
		$scope.data = new Date(jsonData.comments[0].createTime);
		$scope.chengla = false;
		$scope.state=function(i){
			$scope.c_focus = i;
		};
		//添加进购物车
		$scope.c_jiaru = function(){
			c_panding = 0;
			goods[_sId] = details
			zongjia = 0;
			zongshu = 0;
			$scope.jisuanzongjia = function(){
				angular.forEach(goods,function(value,keys){
					zongjia+=value.retailPrice*value.pieceNum;
					zongshu+=value.pieceNum;
				})
			}
			$scope.jisuanzongjia();
			$scope.chengla = true;
			
			//添加成功的小提示
			$timeout(function(){
				$scope.chengla = false;
			},1000,true)
			
		};
		//最低起售标准
		$scope.c_qishou = function(){
			details.pieceNum = details.pieceNum-1
			if(details.pieceNum<1){
				$scope.qishou = true;
				//购买数量低于起售数量时的提醒
				$timeout(function(){
					$scope.qishou = false;
				},1000,true)
			}
			details.pieceNum<=1 ? details.pieceNum=1:details.pieceNum = details.pieceNum-1;
		};
		$http.get("./data/goods.json").success(function(res){
			angular.forEach(res,function(value,keys){
					angular.forEach(value,function(val,key){
						var va=val.itemList;
						angular.forEach(va,function(v,k){
							allgood.push(v);
						});
					});
				});
			angular.forEach(allgood,function(value,key){
				if(value.id==_sId){
					details = value;
					$scope.details = details;
					}
				})
			});
		
	}])